Imports Microsoft.VisualBasic

Public Class Order
    Inherits BaseEntity

    Private _OrderDate As DateTime
    Public Property OrderDate() As DateTime
        Get
            Return _OrderDate
        End Get
        Set(ByVal value As DateTime)
            _OrderDate = value
        End Set
    End Property

    Private _SupplierID As String
    Public Property SupplierID() As String
        Get
            Return _SupplierID
        End Get
        Set(ByVal value As String)
            _SupplierID = value
        End Set
    End Property

    Private _UserID As String
    Public Property UserID() As String
        Get
            Return _UserID
        End Get
        Set(ByVal value As String)
            _UserID = value
        End Set
    End Property

    Private _OrderStatus As Boolean
    Public Property OrderStatus() As Boolean
        Get
            Return _OrderStatus
        End Get
        Set(ByVal value As Boolean)
            _OrderStatus = value
        End Set
    End Property

    Public Property GetOrderStatus() As Boolean
        Get
            If _OrderStatus = True Then
                Return "Draft"
            Else
                Return "Completed"
            End If
        End Get
        Set(ByVal value As Boolean)
        End Set
    End Property

    Public Overrides Function ToString() As String
        Dim buf As String = Me.ID & ", " & Me.OrderDate & ", " & Me.SupplierID & ", " & Me.UserID & ", " & Me.OrderStatus
        buf &= MyBase.ToString()
        Return buf
    End Function

    Public Overloads Function compareAndGetDiff(ByVal _NewObj As Order) As String
        Dim buf As String = ""
        If Me.OrderDate <> _NewObj.OrderDate Then
            buf &= "OrderDate=" & Me.OrderDate & " -> " & _NewObj.OrderDate & " "
        End If

        If Me.SupplierID <> _NewObj.SupplierID Then
            buf &= ", SupplierID=" & SupplierID & " -> " & _NewObj.SupplierID & " "
        End If

        If Me.UserID <> _NewObj.UserID Then
            buf &= ", UserID=" & UserID & " -> " & _NewObj.UserID & " "
        End If


        If Me.OrderStatus <> _NewObj.OrderStatus Then
            buf &= ", OrderStatus=" & OrderStatus & " -> " & _NewObj.OrderStatus & " "
        End If
        buf &= MyBase.compareAndGetDiff(_NewObj)
        Return buf
    End Function
End Class

